package gui;

import java.awt.*;

import javax.swing.*;

import serial.SerialReaderListener;

@SuppressWarnings("serial")
public class OutputFrame extends JFrame implements SerialReaderListener {
	private JTextArea output;
	
	private final static Font COURIER = new Font("Courier", Font.PLAIN, 12);
	
	public OutputFrame() {
		setTitle("Messages from Robot");
		setSize(600, 600);
		output = new JTextArea();
		output.setFont(COURIER);
		output.setEditable(false);
		setLayout(new BorderLayout(1, 1));
		add(new JScrollPane(output), BorderLayout.CENTER);
	}

	public void stringReceived(String input) {
		output.setText(output.getText() + input);
	}

	public void unplugged() {
		stringReceived("[CONNECTION LOST]");
	}

	public void halted() {
		stringReceived("[CONNECTION CLOSED]");
	}
}
